<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
if (window.internals)
  internals.settings.setEditingBehavior('win');

selection_test(
  '<div contenteditable dir="ltr">|abc def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-0 left word');

selection_test(
  '<div contenteditable dir="ltr">a|bc def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-1 left word');

selection_test(
  '<div contenteditable dir="ltr">ab|c def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-2 left word');

selection_test(
  '<div contenteditable dir="ltr">abc| def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-3 left word');

selection_test(
  '<div contenteditable dir="ltr">abc |def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">|abc def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-4 left word');

selection_test(
  '<div contenteditable dir="ltr">abc d|ef hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-5 left word');

selection_test(
  '<div contenteditable dir="ltr">abc de|f hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-6 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def| hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-7 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def |hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc |def hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-8 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def h|ij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def |hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-9 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hi|j <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def |hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-10 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij| <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def |hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-11 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij |<img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def |hij <img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-12 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png">| opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij |<img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-13 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> |opq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij |<img src="../../../accessibility/resources/cake.png"> opq rst </div>',
  '18-14 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> o|pq rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> |opq rst </div>',
  '18-15 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> op|q rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> |opq rst </div>',
  '18-16 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq| rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> |opq rst </div>',
  '18-17 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq |rst </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> |opq rst </div>',
  '18-18 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq r|st </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq |rst </div>',
  '18-19 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq rs|t </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq |rst </div>',
  '18-20 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq rst| </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq |rst </div>',
  '18-21 left word');

selection_test(
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq rst |</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="ltr">abc def hij <img src="../../../accessibility/resources/cake.png"> opq |rst </div>',
  '18-22 left word');
</script>
